<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/css/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/edit.css" rel="stylesheet"/>
<style>

</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
       
        <div class="row">
            <form class="form-horizontal m-t js-ajax-forms" id="signupForm" action="{:U('Admin/ProjectExpert/save')}<if condition="$editdata">&type=update<else />&type=add</if>" method="post" enctype="multipart/form-data">
           	<input type="hidden" name="ID" value="{$editdata['ID']}">
            <div class="col-sm-8  col-md-offset-2">

                <div class="ibox float-e-margins">
                    
                    <div class="ibox-content">

                            <div class="form-group">
                                <label class="col-sm-3 control-label">姓名 *</label>
                                <div class="col-sm-8">
	                                <input id="TrueName" name="TrueName" class="form-control" type="text"  value="{$editdata.TrueName}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">性别*</label>
                                <div class="col-sm-8">
                                	<div style="margin-top:10px;">
                                		<input name="Sex" type="radio" value="1" <if condition="1 eq $editdata['Sex']"> checked </if> />男 
                                		<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                		<input name="Sex" type="radio" value="2" <if condition="2 eq $editdata['Sex']"> checked </if> />女 
                                	</div>
                                	
                                    <!-- select class="form-control" id="Sex" name="Sex" aria-required="true" aria-invalid="true" class="error">
                                    	<option value="">请选择性别</option>
	                                	<option value="1">男</option>
	                                    <option value="2">女</option>
	                                </select -->
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">出生年月</label>
                                <div class="col-sm-8">
	                                <input style="border-color:#cfdadd" type="text" id="Birthday" name="Birthday" class="form-control date laydate-icon"" value="{$editdata.Birthday}">
                                </div>
                            </div>
	                        
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系地址</label>
                                <div class="col-sm-8">
                                   <input id="Address" name="Address" class="form-control" type="text"  value="{$editdata.Address}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">手机*</label>
                                <div class="col-sm-8">
                                    <input id="Phone" name="Phone" class="form-control" type="text"  value="{$editdata.Phone}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">电子邮件</label>
                                <div class="col-sm-8">
                                    <input id="EMail" name="EMail" class="form-control" type="text"  value="{$editdata.EMail}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">身份证号码</label>
                                <div class="col-sm-8">
                                    <input id="CardNO" name="CardNO" class="form-control" type="text"  value="{$editdata.CardNO}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所在单位</label>
                                <div class="col-sm-8">
                                    <input id="Org" name="Org" class="form-control" type="text"  value="{$editdata.Org}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">专业</label>
                                <div class="col-sm-8">
                                    <input id="Major" name="Major" class="form-control" type="text"  value="{$editdata.Major}">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">职称</label>
                                <div class="col-sm-8">
                                    <select class="form-control" id="Title" name="Title" aria-required="true" aria-invalid="true" class="error">
                                    	<option value="">请选择职称</option>
	                                	<option value="1" <if condition="1 eq $editdata['Title']"> selected </if>>助理</option>
	                                    <option value="2" <if condition="2 eq $editdata['Title']"> selected </if>>中级</option>
	                                    <option value="3" <if condition="3 eq $editdata['Title']"> selected </if>>副高级</option>
	                                    <option value="4" <if condition="4 eq $editdata['Title']"> selected </if>>正高级</option>
	                                </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">简历</label>
                                <div class="col-sm-8">
                                    <textarea id="Resume" name="Resume" class="form-control diff-textarea" rows="6">{$editdata.Resume}</textarea>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注</label>
                                <div class="col-sm-8">
                                    <textarea id="Memo" name="Memo" class="form-control diff-textarea" rows="6">{$editdata.Memo}</textarea>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary keep" type="submit">保存</button>
                                    <a class="btn btn-white" href="javascript:void(0);" onclick="self.location=document.referrer;">返回</a>
                                </div>
                            </div>
                        
                    </div>
                </div>
            </div>
           
            </form>
        </div>

    </div>

	<script src="__ROOT__/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
	<script src="__ROOT__/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/layer/laydate/laydate.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
	
 	
	<script>
		$(document).ready(function () {
			
		$.validator.addMethod("isPhone", function (value, element) {
            var phone = /^1[34578]\d{9}$/;
            return phone.test(value);
        }, "请输入正确的手机号码");

			var icon = "<i class='fa fa-times-circle'></i>";
			var form = $('form.js-ajax-forms');
			var formloading = false;
			form.validate({
		        //指定错误信息位置
		        errorPlacement: function (error, element) {
					if (element.is(':radio') || element.is(':checkbox')) {
						var eid = element.attr('name');
						error.appendTo(element.parent());
					} else {
						error.insertAfter(element);
					}
				},
				//验证规则
		        rules: {
		            TrueName: {
		                required: true
		            },Sex: {
		            	required: true
		            },Phone: {
                    	isPhone: true,
                   		required: true
                	},CardNO: {
                   		rangelength: [15, 18]//输入值必须介于 15 和 18 之间。
               		}
		        },
		        //验证未通过提示消息
		        messages: {
		            TrueName:{
		                required: icon + "请选择项目名称"
		            },Sex: {
		            	required: icon + "请选择性别"
		            },Phone: {
                    	required: icon + "请输入手机号码"
                	},CardNO: {
                  		minlength: icon + "身份证位数长度有误"
                	}
		        },
		        //验证通过，提交表单
		        submitHandler : function(forms) {
		        	if (formloading)
	                return;
		            $(forms).ajaxSubmit({
		                url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
		                dataType : 'json',
		                beforeSubmit : function(arr, $form, options) {
		                    formloading = true;
		                },
		                success : function(data, statusText, xhr, $form) {
		                    formloading = false;
		                    if (data.status) {
		                        //添加成功
		                        swal({
		                            title: "继续操作？",
		                            text: "操作成功！",
		                            type: "success",
		                            showCancelButton: true,
		                            confirmButtonColor: "#DD6B55",
		                            confirmButtonText: "确认",
		                            cancelButtonText: "返回",
		                            closeOnConfirm: false,
		                            closeOnCancel: false
		                        },
		                        function (isConfirm) {
		                            if (isConfirm) {
		                                document.location.reload();
		                            } else {
		                                document.location.href = "{:U('ProjectExpert/index')}";
		                                return true;
		                            }
		                        }); 
		                    } else {
		                        swal("操作失败", data.info, "error");
		                    }
		                }
		            });
		        }
		    });
		});
		
		var Birthday = {
            elem: '#Birthday',
            format: 'YYYY-MM-DD',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
               
            }
        };
        laydate(Birthday);
        
	</script>
</body>

</html>
